package com.pur.zsms.querycode.dao.impl;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Query;

import net.sf.json.JSONObject;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Repository;

import com.pur.zsms.common.dao.GenericDao;
import com.pur.zsms.common.dao.JpaTemplate;
import com.pur.zsms.common.exception.GenericException;
import com.pur.zsms.common.support.PageController;
import com.pur.zsms.common.support.PaginationSupport;
import com.pur.zsms.pmsnmanage.menu.po.MenuPo;
import com.pur.zsms.pmsnmanage.role.vo.RoleVo;
import com.pur.zsms.pmsnmanage.user.dao.IUserDao;
import com.pur.zsms.pmsnmanage.user.po.UserPo;
import com.pur.zsms.pmsnmanage.user.po.UserRolePo;
import com.pur.zsms.pmsnmanage.user.vo.UserVo;
import com.pur.zsms.querycode.dao.IQueryCodeDao;
import com.pur.zsms.systemsetting.datadictionary.po.Code;
import com.pur.zsms.systemsetting.datadictionary.po.CodeType;

@Repository("queryCodeDao")
public class QueryCodeDaoImpl  extends GenericDao implements IQueryCodeDao {
  	 
 	public List<Code> listCodeByCodeTypeId(String codeTypeId){
	    StringBuffer ql = new StringBuffer();
	    ql.append("select * from t_Code c");
 	    ql.append(" where c.code_type_id = '"+codeTypeId.trim() + "'");
 	    ql.append(" order by c.code_oder");
	    JpaTemplate template = this.getTemplate();
	    Query query =  this.entityManager.createNativeQuery(ql.toString(),Code.class);   
	    List<Code> list = query.getResultList();   		            
	    this.entityManager.close();   
 	    return list;
	}

 
}
